const mutations = {
  /**
   * 设置存储token
   * @param {object} state
   * @param {string} token
   */
  setToken(state, token) {
    if (!token) return;
    state.token = token;
    uni.setStorageSync('token', token);
  },

  /**
   * 设置user数据
   * @param {object} state
   * @param {object} user
   */
  setUser(state, user) {
    if (!user) return;
    state.user = { ...user };
    uni.setStorageSync('user', JSON.stringify(user));
  },

};

export default mutations;
